package com.cnap.model.strategy.schedule;

import com.cnap.model.schedule.engine.DeployPolicyConfigV2;

/**
 * 成本策略
 *
 * @author xc
 **/
public class CostStrategyDTO extends CommonScheduleDTO {
    private String policy;
    private PriceConfig param;

    /**
     * get
     *
     * @return Policy
     */
    public String getPolicy() {
        return policy;
    }

    /**
     * set
     *
     * @param policy policy
     */
    public void setPolicy(String policy) {
        this.policy = policy;
    }

    /**
     * get
     *
     * @return Param
     */
    public PriceConfig getParam() {
        return param;
    }

    /**
     * set
     *
     * @param param param
     */
    public void setParam(PriceConfig param) {
        this.param = param;
    }

    @Override
    public DeployPolicyConfigV2 toConfigV2() {
        DeployPolicyConfigV2 configV2 = new DeployPolicyConfigV2();
        configV2.setPolicyRatio(this.getPercent());
        configV2.setPolicyParam(this.param.getCostType());
        configV2.setPolicy(PolicyEnum.getEnNameFromChName(this.getPolicy()));
        return configV2;
    }

    public static class PriceConfig {
        /**
         * common为通用价格，agency为代理价格
         */
        private String costType;

        /**
         * get
         *
         * @return CostType
         */
        public String getCostType() {
            return costType;
        }

        /**
         * set
         *
         * @param costType costType
         */
        public void setCostType(String costType) {
            this.costType = costType;
        }
    }
}

